package fr.emn.integration.synthese.presentation;

import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridLayout;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.JTextField;

import fr.emn.integration.synthese.abstraction.Cours;
import fr.emn.integration.synthese.abstraction.Module;
import fr.emn.integration.synthese.controle.ControlJButtonSaveEleve;


public class EleveBDDialog extends JDialog{

	private static final long serialVersionUID = 1L;

	private JTextField nom;
	private JTextField prenom;
	private JTextField mail;

	public String getMail() {
		return mail.getText();
	}
	
	public String getPrenom() {
		return prenom.getText();
	}

	public String getNom() {
		return nom.getText();
	}
	
	

	public EleveBDDialog(Frame parent, Cours modele, boolean creation) {
		super(parent, "Eleve", true);
		this.setMinimumSize(new Dimension(200, 100));

		this.getContentPane().setLayout(new BoxLayout(this.getContentPane(), BoxLayout.X_AXIS));

		JPanel form = new JPanel(new GridLayout(5, 1));
		form.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));

		form.add(new JLabel("Nom"));
		nom = new JTextField();
		form.add(nom);
		form.add(new JLabel("Prenom"));
		prenom = new JTextField();
		form.add(prenom);
		form.add(new JLabel("Mail Eleve"));
		mail = new JTextField();
		form.add(mail);
		JPanel buttons = new JPanel();
		JButton save = new JButton("OK");
		save.addActionListener(new ControlJButtonSaveEleve(this, modele, creation));
		buttons.add(save);
		form.add(buttons);
		
		this.getContentPane().add(form);
		
	
		this.pack();
		super.setLocationRelativeTo(parent);
	}

	
	
}

